1. Field of the Invention
The present invention relates to a virtual computer system and a method for swapping input/output devices (hereinafter referred to as xe2x80x9cI/O devicesxe2x80x9d) between virtual machines and a computer readable storage medium, and more particularly to a virtual computer system and method for swapping I/O devices between virtual machines, which system and method provide a command function which enables I/O devices to be swapped between virtual machines through a single operation and enables simultaneous update of I/O definitions of the virtual machines stored in a VM-configuration information file, and computer readable storage medium thereof.
2. Description of the Related Art
FIGS. 10A and 10B show an example system operation using a virtual computer system. The virtual computer system operates a single real machine as if a plurality of computers were present. Such virtual computers operating on a single real machine are called xe2x80x9cvirtual machines (VMs).xe2x80x9d
In an example case, a virtual machine for daily business and a virtual machine for system development are operated simultaneously on a single real machine. In another example case, future introduction of two real machines is planned for on-line processing and batch processing, respectively, but on a temporary basis, a virtual machine for on-line processing and a virtual machine for batch processing are realized by a single real machine.
FIGS. 10A and 10B show an example in which a virtual computer system is operated according to the latter scheme. In the system, a virtual machine VM1 for on-line processing and a virtual machine VM2 for batch processing are operated on a single real machine R. The virtual machine VM1 uses duplicated volumes A1 and A2 (hereinafter called xe2x80x9cdual volumesxe2x80x9d). During on-line processing, the virtual machine VM1 writes identical data (e.g., document data and log data) in the volumes A1 and A2. When such data is subjected to batch processing such as batch print (document output, etc.), the following operation is performed. One (e.g., A2) of the dual volumes of the virtual machine VM1 is detached from the virtual machine VM1 and is attached to the virtual machine VM2; and a volume B of the virtual machine VM2 is detached from the virtual machine VM2 and is attached to the virtual machine VM1 in order to continue the dual-volume operation. After attachment of the volume B, the virtual machine VM1 copies data of the volume A1 to the volume B and resumes the dual-volume operation.
FIG. 11 shows a conventional technique for operating a virtual computer system as described above.
A monitor program 100 is a control program for controlling virtual machines VM1 and VM2 in a virtual computer system. VM consoles 31 and 32 for operating the virtual machines VM1 and VM2 are connected to the virtual machines VM1 and VM2, respectively. When an I/O device 21 (device number: xcex1) attached to the virtual machine VM1 is swapped with an I/O device 22 (device number: xcex2) attached to the virtual machine VM2 at each of the VM consoles 31 and 32 an operator must input successive commands for detaching and attaching the designated I/O device to be swapped.
Further, simultaneously with the swap of the I/O devices, the operator must update definition information of the I/O devices, which information is held in the virtual computer system and used to allocate the I/O devices to the virtual machines when started.
Specifically, the operator must perform operations (1) to (6) shown in FIG. 11.
(1) Inputting from the VM console 31 a command for detaching the I/O device 21 (device number: xcex1) from the virtual machine VM1.
(2) Inputting from the VM console 32 a command for detaching the I/O device 22 (device number: xcex2) from the virtual machine VM2.
(3) Inputting from the VM console 31 a command for attaching the I/O device 22 (device number: xcex2)to the virtual machine VM1
(4) Inputting from the VM console 32 a command for attaching the I/O device 21 (device number: xcex1) to the virtual machine VM2.
(5) Updating the I/O definition information in the VM-configuration file in order to allocate the I/O device 22 (device number: xcex2) to the virtual machine VM1.
(6) Updating the I/O definition information in the VM-configuration file in order to allocate the I/O device 21 (device number: xcex1) to the virtual machine VM2.
With diversified employment of a virtual computer system, virtual machines have come to be used according to various operation schemes. Under such circumstances, use of an operation scheme in which I/O devices are swapped between a plurality of virtual machines has begun. However, due to the common thought that a virtual device configuration is present individually for each virtual machine, there has been present only a concept of attaching a certain I/O device to a virtual machine and detaching the certain I/O device from the virtual machine, but not a concept of swapping I/O devices between a plurality of virtual machines. Therefore, as commands for the monitor program 100, only a command for attachment of an I/O device and a command for detachment of an I/O device have been provided.
Therefore, conventionally, the operation for swapping I/O devices between virtual machines is very troublesome and requires a long time, as has been described with reference to the example of FIG. 11.
Moreover, since definition information regarding I/O devices swapped between the virtual machines is merely stored on memory of the virtual computer system, if, after swap of the I/O devices, the virtual computer system goes down due to a failure, the information indicting the fact that the I/O devices have been swapped is lost. Therefore, when the virtual machines are re-started after such a system down, the I/O devices are allocated to the virtual machines in accordance with the contents of a VM-configuration information file, which has been provided in advance on a nonvolatile storage device such as a magnetic disk. Therefore, the allocation of the I/O devices returns to the state before swap. In such a case, before starting the virtual machines, the operator must change the I/O definition information stored in the VM-configuration information file in such a manner that the swap of the I/O devices is reflected in the I/O definition information.
An object of the present invention is to solve the problems involved in swap of I/O devices between virtual machines such that a large number of commands must be input, that operation is complex and cumbersome, and that the risk of an operator""s erroneous operation is high.
Another object of the present invention is to solve the problems involved in update of VM-configuration information such that, since the update of VM-configuration information must be performed separately, overall operation becomes complex and cumbersome, and that in some cases proper operation of virtual machines after the update cannot be guaranteed, because the update may involve errors.
Still another object of the present invention is to provide a virtual computer system which enables I/O devices to be swapped between virtual machines through a single operation.
Still another object of the present invention is to provide a method for swapping I/O devices between virtual machines in a virtual computer system, which method enables I/O devices to be swapped between the virtual machines through a single operation.
Still another object of the present invention is to provide a computer readable storage medium storing a program for swapping I/O devices between virtual machines in a virtual computer system, which program enables I/O devices to be swapped between the virtual machines through a single operation.
The present invention provides a virtual computer system comprises a real machine including first and second input/output devices; a plurality of virtual machines being operated on the real machine and including first and second virtual machines; an accepting and analyzing means for accepting and analyzing a single command which instructs swap of the first input/output device allocated to the first virtual machine with the second input/output device allocated to the second virtual machine; a detaching means for detaching the first and second input/output devices from the first and second virtual machines in response to input of the command; and an attaching means for attaching to the first virtual machine the second input/output device detached from the second virtual machine and for attaching to the second virtual machine the first input/output device detached from the first virtual machine.
Preferably, the virtual computer system further comprises a non-volatile storage device which stores input/output-device definition information, the definition information being used for allocating the input/output-devices to the virtual machines when the virtual machines are started; and an updating means for updating the input/output-device definition information stored in the storage device when the input/output devices are swapped.
The present invention also provides a method for swapping input/output devices in a virtual computer system having a plurality of virtual machines being operated on a real machine, and the method comprises accepting and analyzing a single command which instructs swap of a first input/output device allocated to a first virtual machine with a second input/output device allocated to a second virtual machine; detaching the first and second input/output devices from the first and second virtual machines in response to input of the command; attaching to the first virtual machine the second input/output device detached from the second virtual machine and attaching to the second virtual machine the first input/output device detached from the first virtual machine; and updating input/output definition information previously stored in a non-volatile storage device, the input/output definition information being used for allocating the input/output devices to the virtual machines when the virtual machines are started.
The present invention also provides a computer readable storage medium storing a program which enables I/O devices to be swapped between the virtual machines through a single operation.